package com.bootdo.system.controller;

import com.bootdo.common.utils.R;
import com.bootdo.system.domain.SmstableDO;
import com.bootdo.system.service.SmstableService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 
 * 
 * @author xxx
 * @email xxx@xxx.com
 * @date 2021-01-29 15:31:16
 */
 
@Controller
@RequestMapping("/system/smstable")
public class SmstableController {
	@Autowired
	private SmstableService smstableService;
	
	@GetMapping()
	@RequiresPermissions("system:smstable:smstable")
	String Smstable(Model model){
        SmstableDO smstableDO = smstableService.get(1);
        model.addAttribute("smstableDO",smstableDO);
        return "system/smstable/smstable";
	}
	



	@GetMapping("/edit/{id}")
	@RequiresPermissions("system:smstable:edit")
	String edit(@PathVariable("id") Integer id,Model model){
		SmstableDO smstable = smstableService.get(id);
		model.addAttribute("smstable", smstable);
	    return "system/smstable/edit";
	}
	

	/**
	 * 修改
	 */
	@ResponseBody
	@RequestMapping("/update")
	@RequiresPermissions("system:smstable:edit")
	public R update(SmstableDO smstable){
		smstableService.update(smstable);
		return R.ok();
	}
	

	
}
